package com.pwser.common.interf;

import java.util.List;

import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import com.pwser.common.entities.Dept;
import com.pwser.common.fallback.DeptServiceFallbackFactory;

//@FeignClient(name = "springcloud-provider")
@FeignClient(name = "springcloud-provider", fallbackFactory = DeptServiceFallbackFactory.class)
public interface DeptServiceInterf {

	@PostMapping(value = "/dept/add")
	public boolean add(Dept dept);

	@GetMapping(value = "/dept/get/{id}")
	public Dept get(@PathVariable("id") Long id);

	@GetMapping(value = "/dept/list")
	public List<Dept> list();

	@GetMapping(value = "/dept/discovery")
	public List<String> discovery();

	@GetMapping(value = "/dept/discovery/{serviceId}")
	public List<ServiceInstance> getServiceById(@PathVariable("serviceId") String serviceId);

	@GetMapping(value = "/dept/avalanche")
	public List<Dept> avalanche() throws InterruptedException;

}
